﻿var SnakeSegment = DisplayObject.extend(
{
	constructor: function(x, y)
	{
		this.x = x;
		this.y = y;
		this.width = SnakeSegment.SIZE;
		this.height = SnakeSegment.SIZE;
		this.addToStage();
	},

	draw: function()
	{
		var realSize = SnakeSegment.SIZE * 0.85;
		var offset = (SnakeSegment.SIZE - realSize) * 0.5;
		g_context.fillStyle = SnakeSegment.BODY_COLOR;
		g_context.strokeStyle = SnakeSegment.BORDER_COLOR;
		g_context.fillRect(this.x + offset, this.y + offset, realSize, realSize);
		g_context.strokeRect(this.x + offset, this.y + offset, realSize, realSize);
	},
	
	moveTo: function(x, y)
	{
		this.x = x;
		this.y = y;
	}
},
{
	//class interface
	SIZE: 20,
	BODY_COLOR: '#009900',
	BORDER_COLOR: '#001F00'
});